Q: What is java OR core java?
Java is a programming language (Heavy weight language). Universal language.


Q: Why we are learning core java?
Ans: Our main intention is to learn a tool viz., Selenium WebDriver which understands java.


Q: Who is the vendor for java?
Ans: Oracle


Q: Can i write java directly in our PC (OS)?
Ans: The OS by default can't understand java. you can write/Type the java but you can't compile and run the java in Window OS by default.


Q: How to compile and run the java in our OS?
Ans: We need to install the java JDK (Java Developement Kit) (Java engine)


Q: How to check java is already installed?
Ans: go to run window. (Press Wnd + R) & type cmd & Click OK button
type java & press ENTER button.


Q: How to install java JDK?
Ans: We will install java JDK 21.
1. Go to google & search for "Download java JDK 21"
2. Click on the oracle link (java is owned by oracle)
3. Select the respective installer based on your OS & click on the installer to download it.
4. Optional: Accept the Licence agreement. Register to oracle website & download the .exe file
5. Install it.


Q: How to check which version of java is installed?
Ans: go to command prompt & type below command
java -version & press ENTER


Q: Does java is case sensitive?
Ans: Yes. Java is highly case sensitive.
Note: Every thing in java is lower case. But only in 3 places the first letter must be capital:
(a) class
(b) abstract class
(c) Interface


Q: What is JDK? What happens upon installation of JDK?
Ans: JDK is Java Developement Kit.
Upon installation it gives:

JRE (Java Runtime Environment): This is a set of software tools that provides the runtime environment needed to execute Java applications. It includes the JVM (Java Virtual Machine), class libraries, and other files that are necessary for running Java applications. The JRE does not include development tools such as compilers and debuggers; it's solely for running Java programs.

JVM (Java Virtual Machine): This is the engine that actually executes Java bytecode. It's responsible for interpreting or compiling Java bytecode into machine code that can be executed by the underlying hardware. The JVM is platform-dependent and abstracts the underlying operating system and hardware, providing a consistent environment for Java programs to run across different platforms.

In summary, JRE is the environment in which Java programs run, and it includes the JVM. The JVM is the component responsible for executing Java bytecode.


Q: Does java is a compiler OR interpreuter?
Ans: Java is a programming language hence it is a compiler. But it acts like a interpreuter also.


Q: What is extenstion of java source file?
Ans. .java is the extenstion for the java source file


Q: How to write java in notepad?
Ans: Open notepad->Type java code->Save as <ClassName>.java and 
save as type should be All Files(*).

Run java through command prompt without classpath?
Ans:
1. Create source file. Ex: Sample.java
 
2. Compile it using javac command.
   Note: Go to command prompt--> Navigate to "C:\Program Files\Java\jdk-21\bin". Type below command to compile java source file.
   javac <Source file complete path>;
   
3. Upon compilation it creates .class file (Byte code). This class files are platform Independent

4. Run the .class file using java command
   java -cp <class file folder path> <class file name>

   
Q: Does java is platform Independent?
Ans: Yes. Especially the .class files (Byte codes) which are created upon compilation are platform independent.


Q: Why JDK is required?
Ans: The JDK is a engine which is required to compile & run the java program.


Q: Why should I go to bin folder to compile the java code.?
Ans: Bcoz the javac (compiler) is present inside the /bin folder. Hence we need to go to bin folder and compile the java


Q: I want to compile my code from any directory?
Ans:
You can do that. To do that we have to make the compiler global by setting its path in the System environment variable. This is called class path



Q: What is class path? Why required?
Ans: It is a process of making the compiler global by setting the compiler path in System environment variable.

With the help of class path we can directly compile & run the java programe from any directory.


Q: How to set the class path?
Ans:
1. Copy the java JDK installation path (C:\Program Files\Java\jdk-21\)

2. Go to My Computer->Right click & select Properties->Advanced System Settings->Advanced->Environment Variable-> System variable

OR

In latest window OS, go to start--->Type "edit the system Environment Variable"-->Advanced->Environment Variable-> System variable

3. Create a new System variable as JAVA_HOME & give the jdk installation path as a value.

4. go to "path" variable--> Click on Edit button--> and add the complete bin folder path as shown below:
C:\Program Files\Java\jdk-17\bin


Q: Does JDK, JRE and JVM are platform independent?
Ans: No. The JDK, JRE and JVM are platform dependent.


Q: Why java is a secured language?
Ans: Bcoz the class files which are created upon compilation and very difficult to decode it and the class file will never get affected with virus.

